package cn.sh.cares.tools.srcgen.freemarker;

import java.util.HashMap;
import java.util.Map;

import cn.sh.cares.tools.srcgen.Generator;
import cn.sh.cares.tools.srcgen.db.TableDefinition;
import cn.sh.cares.tools.srcgen.util.ResourceManager;

public class DAOImplGenerator extends FreeMarkerGenerator implements Generator {

	public String generateFileName(TableDefinition tableDefinition) {
		return tableDefinition.getJavaClass() + "DAOImpl.java";
	}
	
	public String getOutputDirectory() {
		return ResourceManager.getMessage("outputdir.DAOImpl");
	}
	
	public String getTemplateFileName() {
		return ResourceManager.getMessage("template.DAOImpl");
	}
	
	public Map<String, Object> create(TableDefinition tableDefinition) {
		Map<String, Object> templateData = new HashMap<String, Object>();
		
		templateData.put("model", tableDefinition);
		
		templateData.put("package", ResourceManager.getMessage("package.DAOImpl"));
		
		return templateData;
	}
}
